using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class GT_PKT_IPDETMap : EntityTypeConfiguration<GT_PKT_IPDET>
    {
        public GT_PKT_IPDETMap()
        {
            // Primary Key
            this.HasKey(t => new { t.TYPE, t.NUMBER, t.QTY, t.CURRENCY, t.COST, t.ENTRY_NO });

            // Properties
            this.Property(t => t.TYPE)
                .IsRequired()
                .HasMaxLength(1);

            this.Property(t => t.NUMBER)
                .IsRequired()
                .HasMaxLength(7);

            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.LOCATION)
                .HasMaxLength(3);

            this.Property(t => t.CURRENCY)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.ENTRY_NO)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.MANUFACCODE)
                .HasMaxLength(15);

            this.Property(t => t.CUSTOM1)
                .HasMaxLength(6);

            this.Property(t => t.CUSTOM2)
                .HasMaxLength(6);

            this.Property(t => t.DESC)
                .HasMaxLength(50);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            this.Property(t => t.IP_SourceNumber)
                .HasMaxLength(10);

            this.Property(t => t.IP_SourceType)
                .IsFixedLength()
                .HasMaxLength(1);

            // Table & Column Mappings
            this.ToTable("GT_PKT_IPDET");
            this.Property(t => t.TYPE).HasColumnName("TYPE");
            this.Property(t => t.NUMBER).HasColumnName("NUMBER");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
            this.Property(t => t.QTYREC).HasColumnName("QTYREC");
            this.Property(t => t.QTYREGW).HasColumnName("QTYREGW");
            this.Property(t => t.QTY).HasColumnName("QTY");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.EXTEND).HasColumnName("EXTEND");
            this.Property(t => t.COST).HasColumnName("COST");
            this.Property(t => t.ENTRY_NO).HasColumnName("ENTRY_NO");
            this.Property(t => t.GROSSWGHT).HasColumnName("GROSSWGHT");
            this.Property(t => t.PUREWGHT).HasColumnName("PUREWGHT");
            this.Property(t => t.PUREVALUE).HasColumnName("PUREVALUE");
            this.Property(t => t.MKGSPERGRM).HasColumnName("MKGSPERGRM");
            this.Property(t => t.MKGSTOTAL).HasColumnName("MKGSTOTAL");
            this.Property(t => t.VENDCURR).HasColumnName("VENDCURR");
            this.Property(t => t.PURITY).HasColumnName("PURITY");
            this.Property(t => t.MANUFACCODE).HasColumnName("MANUFACCODE");
            this.Property(t => t.ITEMTYPE).HasColumnName("ITEMTYPE");
            this.Property(t => t.ITEMCATEGORY).HasColumnName("ITEMCATEGORY");
            this.Property(t => t.MASTERITEM).HasColumnName("MASTERITEM");
            this.Property(t => t.MASTERITEMID).HasColumnName("MASTERITEMID");
            this.Property(t => t.CUSTOM1).HasColumnName("CUSTOM1");
            this.Property(t => t.CUSTOM2).HasColumnName("CUSTOM2");
            this.Property(t => t.RetailPrice).HasColumnName("RetailPrice");
            this.Property(t => t.DESC).HasColumnName("DESC");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.UOFMORDERS).HasColumnName("UOFMORDERS");
            this.Property(t => t.IP_SourceNumber).HasColumnName("IP_SourceNumber");
            this.Property(t => t.IP_SourceType).HasColumnName("IP_SourceType");
            this.Property(t => t.SPID).HasColumnName("SPID");
            this.Property(t => t.C_deleted).HasColumnName("_deleted");
            this.Property(t => t.IPDet_IP_UID2).HasColumnName("IPDet_IP_UID2");
            this.Property(t => t.ipdet_ImportedFrom).HasColumnName("ipdet_ImportedFrom");
            this.Property(t => t.IPDET_Overhead).HasColumnName("IPDET_Overhead");
            this.Property(t => t.IPDET_Profit).HasColumnName("IPDET_Profit");
            this.Property(t => t.IPDET_LandedCost).HasColumnName("IPDET_LandedCost");
            this.Property(t => t.IPDET_UofmSales).HasColumnName("IPDET_UofmSales");
            this.Property(t => t.IPDET_Optional).HasColumnName("IPDET_Optional");
            this.Property(t => t.IPDet_Delivery).HasColumnName("IPDet_Delivery");
            this.Property(t => t.IPdet_Cost_Curr).HasColumnName("IPdet_Cost_Curr");
        }
    }
}
